package com.singletonapps.evory.service.impl;

import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.singletonapps.evory.dao.RoleDao;
import com.singletonapps.evory.dto.RoleDto;
import com.singletonapps.evory.entities.Role;
import com.singletonapps.evory.service.RoleService;

@Service
@Transactional
public class RoleServiceImpl implements RoleService {
    
    private static final Logger LOGGER = LogManager.getLogger(RoleServiceImpl.class.getName());
    
    @Autowired
    private RoleDao roleDao;
    
    @Override
    public void create(RoleDto dto) {
        
        try {
            RoleDto role = new RoleDto();
            role.setId(dto.getId());
            role.setRoleName(dto.getRoleName());
            role.setDateCreate(dto.getDateCreate());
            
            roleDao.create(role);
        } catch (Exception e) {
            LOGGER.error("Error creando el Role.", e);
        }

    }

    @Override
    public void update(RoleDto dto) {
        // TODO Auto-generated method stub

    }

    @Override
    public void delete(RoleDto dto) {
        // TODO Auto-generated method stub

    }

    @Override
    public Role getRole(Long id) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public List<RoleDto> getAllRoles() {
        // TODO Auto-generated method stub
        return null;
    }

}
